package com.iraeta.controller;

import com.iraeta.service.xiangmu.XiangMuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component
@EnableScheduling
@EnableAsync
public class GlobalTask {
    private static final Logger logger = LoggerFactory.getLogger(GlobalTask.class);

    @Autowired
    XiangMuService xiangMuService;

    //每30秒执行一次心跳的数据库查询
    @Scheduled(fixedDelay = 30000)
    @Async("cstaskexecutor")
    public void testJump() {
        xiangMuService.listAll();
    }
}
